package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.health.pojo.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * @program: health_paret
 * @description:
 * @author: Mr.Wang
 * @create: 2020-11-12 22:42
 **/
public interface OrderMapper extends BaseMapper<Order> {
    @Select("select count(1) from t_order where SETMEAL_ID= #{i} and ORDERDATE = #{orderDate} and ID=#{id}")
    int findOrderBySetmealIdAndOrderDateAndMemberId(@Param("i") int i, @Param("orderDate") String orderDate, @Param("id") Integer id);

    @Select("select tm.NAME as member ,ts.NAME as setmeal,too.ORDERDATE as orderDate,too.ORDERTYPE as orderType from t_order too,t_member tm,t_setmeal ts where too.SETMEAL_ID = ts.id and too.MEMBER_ID = tm.id and too.id=#{id}")
    Map findOrderInfoByOrderId(int id);

}
